import table from '@/components/dt/table/render.js'
import Opt from '@/components/dt/info/Opt.js'

let _this = null

class Column extends Opt {
  constructor(vm) {
    super()
    _this = vm
    this.build()
  }

  build() {
    this.createAll()
    this.opts.push(...this.all)
  }

  createAll() {
    this.all = [
      {
        title: '配置项',
        field: 'settingItem',
        minWidth: 350,
        align: 'center'
      },
      {
        title: '配置内容',
        field: 'settingContent',
        minWidth: 350,
        align: 'center'
      },

      {
        title: '操作',
        minWidth: 350,
        align: 'center',
        slots: {
          default: (params, h) => {
            let btns = [
              {
                title: _this.unlocking('0213090600') ? '设置' : '',
                event: 'editFun',
                data: params.row
              }
            ]
            return table.cell.btns(_this, h, btns)
          }
        }
      }
    ]
  }
}

export default Column
